53

Explore Your Deductive Logic—Sudoku

53

Just focusing on column 2, notice that 5 can be in rows 3, 6, or 7. But 2 and 6 can

only be in rows 3 and 7. Since 5 has an alternate home and 2 and 6 don’t, 5 can be

eliminated from rows 3 and 7. This makes 5 a sole candidate for row 6.

The instructions for this method will be similar but slightly different from the pre­

vious “love-​locked pair” scenario. Instead of looking for cells that have exactly seven

members in their cantbelist in the same row, column, or 3 by 3 grid, we will need to

look for two “putnumbers” that can occupy the same two cells. I have left it for the

reader to figure this out.

3.6  THE GOLDEN TRIANGLE

The next algorithm we will discuss is the algorithm of the golden rectangle.

In the example below, 2 can only be in rows 2 and 8 for the green columns. This

means 2 cannot be in the red cells in the rows 2 and 8 because the corners of the rect­

angle marked by the number (2) below have to be occupied with 2. This means we

can remove 2 from the cantbelist for all the red cells.

1

5

(2,6)

(2,3)

3

4

4

8

5

9

7

1

8

6

(2,6)

(2,3)

9

7

COLUMN 1 2 3 4 5 6 7 8 9

9 8 7 6 5 4 3 2 1

ROW

FIGURE 3.7  Golden rectangle.

The code below can be used to apply this logic.

STEP 14

The first step is to identify the corners of the rectangle and store them in an array.

This array is called putnumberpresent below. The entire column is scanned for a

candidate number (putnumber) and if the column contains exactly two cells that

could be a home for this number, this column is remembered along with the two rows

that could potentially be the two corners of the rectangle.

‘*** algorithm to detect a golden rectangle

‘ Check each column and build putnumberpresent

For putnumber =​ 1 To 9

: